home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / STRINGS / TPSTR7 / EXAM31.PAS < prev    next >
Pascal/Delphi Source File  |  1993-03-15  |  3KB  |  62 lines

  1. Program Exam31;
  2.  
  3. {**************************************************************************}
  4. {                                                                          }
  5. { Ce programme démontre les possibilités de StrRoll?.                      }
  6. {                                                                          }
  7. {**************************************************************************}
  8.  
  9. Uses
  10.   TpStr;
  11.  
  12. Var
  13.   S1 ,
  14.   S2 : String;
  15.  
  16. {  ---------------------------------------------------------------         }
  17. {  Procedure   StrRoll(Var Str1: String;Count: Integer);                   }
  18. {  ---------------------------------------------------------------         }
  19. {                                                                          }
  20. {  Effet     : Décale la la chaîne <Str1> de <Count> caractères vers la    }
  21. {              droite ou vers la gauche selon la valeur de <Count>.        }
  22. {                                                                          }
  23. {  Usage     : Chaîne pascal.                                              }
  24. {                                                                          }
  25. {  Vitesse   : 7800/s                                                      }
  26. {                                                                          }
  27. { -------------------------------------------------------------------------}
  28.  
  29. Procedure Test1;
  30. Begin
  31.   S1 := 'abcdefghijklmnopqrstuvwxyz';
  32.   StrRoll(S1,2);
  33.   S1 := 'abcdefghijklmnopqrstuvwxyz';
  34.   StrRoll(S1,-2);
  35. end;
  36.  
  37. {  ---------------------------------------------------------------         }
  38. {  Function   StrRoll_(Str1: String;Count: Integer):String;                }
  39. {  ---------------------------------------------------------------         }
  40. {                                                                          }
  41. {  Effet     : Idem, transformé en fonction.                               }
  42. {                                                                          }
  43. {  Usage     : Chaîne pascal.                                              }
  44. {                                                                          }
  45. {  Vitesse   : 7800/s                                                      }
  46. {                                                                          }
  47. { -------------------------------------------------------------------------}
  48.  
  49. Procedure Test2;
  50. Begin
  51.   S1 := 'zyxwvutsrqponmlkjihgfedcba';
  52.   S2 := StrRoll_(S1,2);
  53.   S2 := StrRoll_('abcde',-2);
  54. end;
  55.  
  56. Begin
  57.   Test1;
  58.   Test2;
  59. End.
  60.  
  61. { -------------------------------------------------------------------------}
  62.